package com.sec.android.app.myfiles.info;

import android.mtp.MtpConstants;

public class FileType {
    public static final int UNKNOWN = 0;

    // Image Files
    private static final int FIRST_IMAGE_FILE_TYPE = 10;
    private static int LAST_IMAGE_FILE_TYPE = FIRST_IMAGE_FILE_TYPE;
    public static final int JPEG = LAST_IMAGE_FILE_TYPE++;
    public static final int JPG = LAST_IMAGE_FILE_TYPE++;
    public static final int MY5 = LAST_IMAGE_FILE_TYPE++;
    public static final int GIF = LAST_IMAGE_FILE_TYPE++;
    public static final int PNG = LAST_IMAGE_FILE_TYPE++;
    public static final int BMP = LAST_IMAGE_FILE_TYPE++;
    public static final int XBMP = LAST_IMAGE_FILE_TYPE++;
    public static final int WBMP = LAST_IMAGE_FILE_TYPE++;
    public static final int MPO = LAST_IMAGE_FILE_TYPE++;
    public static final int GOLF = LAST_IMAGE_FILE_TYPE++;
    public static final int WEBP = LAST_IMAGE_FILE_TYPE++;

    public static final int RAF = LAST_IMAGE_FILE_TYPE++; //FujiFilm
    public static final int ORF = LAST_IMAGE_FILE_TYPE++; //Olympus
    public static final int ERF = LAST_IMAGE_FILE_TYPE++; //Epson
    public static final int FFF = LAST_IMAGE_FILE_TYPE++; //Imacon
    public static final int CRW = LAST_IMAGE_FILE_TYPE++; //Cannon
    public static final int CR2 = LAST_IMAGE_FILE_TYPE++;
    public static final int CR3 = LAST_IMAGE_FILE_TYPE++;
    public static final int DNG = LAST_IMAGE_FILE_TYPE++; //Adobe
    public static final int MEF = LAST_IMAGE_FILE_TYPE++; //Mamiya
    public static final int MOS = LAST_IMAGE_FILE_TYPE++;
    public static final int PXN = LAST_IMAGE_FILE_TYPE++; //Logitech
    public static final int SRW = LAST_IMAGE_FILE_TYPE++; //Samsung
    public static final int PTX = LAST_IMAGE_FILE_TYPE++; //Pentax
    public static final int PEF = LAST_IMAGE_FILE_TYPE++;
    public static final int RW2 = LAST_IMAGE_FILE_TYPE++; //Panasonic
    public static final int BAY = LAST_IMAGE_FILE_TYPE++; //Casio
    public static final int TIF = LAST_IMAGE_FILE_TYPE++; //Kodak
    public static final int K25 = LAST_IMAGE_FILE_TYPE++;
    public static final int KDC = LAST_IMAGE_FILE_TYPE++;
    public static final int DCS = LAST_IMAGE_FILE_TYPE++;
    public static final int DCR = LAST_IMAGE_FILE_TYPE++;
    public static final int DRF = LAST_IMAGE_FILE_TYPE++;
    public static final int ARW = LAST_IMAGE_FILE_TYPE++; //Sony
    public static final int SRF = LAST_IMAGE_FILE_TYPE++;
    public static final int SR2 = LAST_IMAGE_FILE_TYPE++;
    public static final int CAP = LAST_IMAGE_FILE_TYPE++; //FaceOne
    public static final int IIQ = LAST_IMAGE_FILE_TYPE++;
    public static final int MRW = LAST_IMAGE_FILE_TYPE++; //Minolta
    public static final int X3F = LAST_IMAGE_FILE_TYPE++; //Sigma
    public static final int R3D = LAST_IMAGE_FILE_TYPE++; //Red
    public static final int NEF = LAST_IMAGE_FILE_TYPE++; //Nikon
    public static final int NRW = LAST_IMAGE_FILE_TYPE++;

    // Audio file types
    private static final int FIRST_AUDIO_FILE_TYPE = 100;
    private static int LAST_AUDIO_FILE_TYPE = FIRST_AUDIO_FILE_TYPE;
    public static final int MP3 = LAST_AUDIO_FILE_TYPE++;
    public static final int MPGA = LAST_AUDIO_FILE_TYPE++;
    public static final int M4A = LAST_AUDIO_FILE_TYPE++;
    public static final int WAV = LAST_AUDIO_FILE_TYPE++;
    public static final int AMR = LAST_AUDIO_FILE_TYPE++;
    public static final int AWB = LAST_AUDIO_FILE_TYPE++;
    public static final int WMA = LAST_AUDIO_FILE_TYPE++;
    public static final int OGG = LAST_AUDIO_FILE_TYPE++;
    public static final int OGA = LAST_AUDIO_FILE_TYPE++;
    public static final int AAC = LAST_AUDIO_FILE_TYPE++;
    public static final int _3GA = LAST_AUDIO_FILE_TYPE++;
    public static final int FLAC = LAST_AUDIO_FILE_TYPE++;
    public static final int PYA = LAST_AUDIO_FILE_TYPE++;
    public static final int MP4_A = LAST_AUDIO_FILE_TYPE++;
    public static final int MP4_AUDIO = LAST_AUDIO_FILE_TYPE++;
    public static final int _3GP_AUDIO = LAST_AUDIO_FILE_TYPE++;
    public static final int _3G2_AUDIO = LAST_AUDIO_FILE_TYPE++;
    public static final int ASF_AUDIO = LAST_AUDIO_FILE_TYPE++;
    public static final int _3GPP_AUDIO = LAST_AUDIO_FILE_TYPE++;
    public static final int QCP = LAST_AUDIO_FILE_TYPE++;
    public static final int MKA = LAST_AUDIO_FILE_TYPE++;
    public static final int DSF = AppFeatures.DSD_ENABLED ? LAST_AUDIO_FILE_TYPE++ : UNKNOWN;
    public static final int DFF = AppFeatures.DSD_ENABLED ? LAST_AUDIO_FILE_TYPE++ : UNKNOWN;
    public static final int APE = AppFeatures.APE_ENABLED ? LAST_AUDIO_FILE_TYPE++ : UNKNOWN;

    // MIDI Files
    private static final int FIRST_MIDI_FILE_TYPE = 150;
    private static int LAST_MIDI_FILE_TYPE = FIRST_MIDI_FILE_TYPE;
    public static final int MID = LAST_MIDI_FILE_TYPE++;
    public static final int MID_A = LAST_MIDI_FILE_TYPE++;
    public static final int MIDI = LAST_MIDI_FILE_TYPE++;
    public static final int XMF = LAST_MIDI_FILE_TYPE++;
    public static final int MXMF = LAST_MIDI_FILE_TYPE++;
    public static final int RTX = LAST_MIDI_FILE_TYPE++;
    public static final int RTL = LAST_MIDI_FILE_TYPE++;
    public static final int OTA = LAST_MIDI_FILE_TYPE++;
    public static final int SMF = LAST_MIDI_FILE_TYPE++;
    public static final int IMY = LAST_MIDI_FILE_TYPE++;
    public static final int SPM = LAST_MIDI_FILE_TYPE++;
    public static final int SPMID = LAST_MIDI_FILE_TYPE++;

    /**
     * Playlist file types
     */
    private static final int FIRST_PLAYLIST_FILE_TYPE = 180;
    private static int LAST_PLAYLIST_FILE_TYPE = FIRST_PLAYLIST_FILE_TYPE;
    public static final int M3U = LAST_PLAYLIST_FILE_TYPE++;
    public static final int PLS = LAST_PLAYLIST_FILE_TYPE++;
    public static final int WPL = LAST_PLAYLIST_FILE_TYPE++;

    // Video Files
    private static final int FIRST_VIDEO_FILE_TYPE = 200;
    private static int LAST_VIDEO_FILE_TYPE = FIRST_VIDEO_FILE_TYPE;
    public static final int MP4 = LAST_VIDEO_FILE_TYPE++;
    public static final int M4V = LAST_VIDEO_FILE_TYPE++;
    public static final int _3GP = LAST_VIDEO_FILE_TYPE++;
    public static final int _3GPP = LAST_VIDEO_FILE_TYPE++;
    public static final int _3GPP2 = LAST_VIDEO_FILE_TYPE++;
    public static final int _3G2 = LAST_VIDEO_FILE_TYPE++;
    public static final int WMV = LAST_VIDEO_FILE_TYPE++;
    public static final int MPG = LAST_VIDEO_FILE_TYPE++;
    public static final int MPEG = LAST_VIDEO_FILE_TYPE++;
    public static final int ASF = LAST_VIDEO_FILE_TYPE++;
    public static final int AVI = LAST_VIDEO_FILE_TYPE++;
    public static final int DIVX = LAST_VIDEO_FILE_TYPE++;
    public static final int FLV = LAST_VIDEO_FILE_TYPE++;
    public static final int MKV = LAST_VIDEO_FILE_TYPE++;
    public static final int MOV = LAST_VIDEO_FILE_TYPE++;
    public static final int PYV = LAST_VIDEO_FILE_TYPE++;
    public static final int SKM = LAST_VIDEO_FILE_TYPE++;
    public static final int K3G = LAST_VIDEO_FILE_TYPE++;
    public static final int AK3G = LAST_VIDEO_FILE_TYPE++;
    public static final int WEBM = LAST_VIDEO_FILE_TYPE++;
    public static final int RM = LAST_VIDEO_FILE_TYPE++;
    public static final int RMVB = LAST_VIDEO_FILE_TYPE++;
    public static final int SDP = LAST_VIDEO_FILE_TYPE++;
    public static final int TS = LAST_VIDEO_FILE_TYPE++;
    public static final int MTS = LAST_VIDEO_FILE_TYPE++;
    public static final int M2TS = LAST_VIDEO_FILE_TYPE++;
    public static final int M2T = LAST_VIDEO_FILE_TYPE++;
    public static final int TRP = LAST_VIDEO_FILE_TYPE++;
    public static final int TP = LAST_VIDEO_FILE_TYPE++;

    // Document
    public static final int FIRST_DOCUMENT_FILE_TYPE = 300;
    public static int LAST_DOCUMENT_FILE_TYPE = FIRST_DOCUMENT_FILE_TYPE;
    public static final int SPD = LAST_DOCUMENT_FILE_TYPE++;
    public static final int SNB = LAST_DOCUMENT_FILE_TYPE++;
    public static final int HWP = LAST_DOCUMENT_FILE_TYPE++;
    public static final int HWPX = LAST_DOCUMENT_FILE_TYPE++;
    public static final int HWT = LAST_DOCUMENT_FILE_TYPE++;
    public static final int GUL = LAST_DOCUMENT_FILE_TYPE++;
    public static final int ASC = LAST_DOCUMENT_FILE_TYPE++;
    public static final int PPS = LAST_DOCUMENT_FILE_TYPE++;
    public static final int CSV = LAST_DOCUMENT_FILE_TYPE++;
    public static final int PDF = LAST_DOCUMENT_FILE_TYPE++;
    public static final int RTF = LAST_DOCUMENT_FILE_TYPE++;
    public static final int DOC = LAST_DOCUMENT_FILE_TYPE++;
    public static final int DOCX = LAST_DOCUMENT_FILE_TYPE++;
    public static final int DOCM = LAST_DOCUMENT_FILE_TYPE++;
    public static final int DOT = LAST_DOCUMENT_FILE_TYPE++;
    public static final int DOTX = LAST_DOCUMENT_FILE_TYPE++;
    public static final int HWDT = LAST_DOCUMENT_FILE_TYPE++;
    public static final int XLS = LAST_DOCUMENT_FILE_TYPE++;
    public static final int XLSX = LAST_DOCUMENT_FILE_TYPE++;
    public static final int XLT = LAST_DOCUMENT_FILE_TYPE++;
    public static final int XLTX = LAST_DOCUMENT_FILE_TYPE++;
    public static final int XLSM = LAST_DOCUMENT_FILE_TYPE++;
    public static final int PPT = LAST_DOCUMENT_FILE_TYPE++;
    public static final int PPTX = LAST_DOCUMENT_FILE_TYPE++;
    public static final int PPTM = LAST_DOCUMENT_FILE_TYPE++;
    public static final int POT = LAST_DOCUMENT_FILE_TYPE++;
    public static final int POTX = LAST_DOCUMENT_FILE_TYPE++;
    public static final int PPSX = LAST_DOCUMENT_FILE_TYPE++;
    public static final int TXT = LAST_DOCUMENT_FILE_TYPE++;
    public static final int HTM = LAST_DOCUMENT_FILE_TYPE++;
    public static final int HTML = LAST_DOCUMENT_FILE_TYPE++;
    public static final int MEMO = LAST_DOCUMENT_FILE_TYPE++;
    public static final int XML = LAST_DOCUMENT_FILE_TYPE++;
    public static final int SDOC = LAST_DOCUMENT_FILE_TYPE++;
    public static final int SHOW = LAST_DOCUMENT_FILE_TYPE++;
    public static final int XLSB = LAST_DOCUMENT_FILE_TYPE++;
    public static final int XLTM = LAST_DOCUMENT_FILE_TYPE++;
    public static final int CELL = LAST_DOCUMENT_FILE_TYPE++;
    public static final int HCDT = LAST_DOCUMENT_FILE_TYPE++;
    public static final int PRN = LAST_DOCUMENT_FILE_TYPE++;
    public static final int TSV = LAST_DOCUMENT_FILE_TYPE++;
    public static final int XDW = LAST_DOCUMENT_FILE_TYPE++;

    private static final int FIRST_INSTALL_FILE_TYPE = 400;
    private static int LAST_INSTALL_FILE_TYPE = FIRST_INSTALL_FILE_TYPE;
    public static final int APK = LAST_INSTALL_FILE_TYPE++;
    public static final int WGT = LAST_INSTALL_FILE_TYPE++;

    public static final int FIRST_ARCHIVE_FILE_TYPE = 410;
    public static int LAST_ARCHIVE_FILE_TYPE = FIRST_ARCHIVE_FILE_TYPE;
    public static final int ZIP = LAST_ARCHIVE_FILE_TYPE++;

    private static final int FIRST_DRM_FILE_TYPE = 420;
    private static int LAST_DRM_FILE_TYPE = FIRST_DRM_FILE_TYPE;
    public static final int DCF = LAST_DRM_FILE_TYPE++;
    public static final int SM4 = LAST_DRM_FILE_TYPE++;
    public static final int ODF = LAST_DRM_FILE_TYPE++;

    // certificate - reference MediaFile.java(in framework)
    public static final int FIRST_CERTIFICATE_FILE_TYPE = 430;
    public static int LAST_CERTIFICATE_FILE_TYPE = FIRST_CERTIFICATE_FILE_TYPE;
    public static final int P12 = LAST_CERTIFICATE_FILE_TYPE++;
    public static final int PFX = LAST_CERTIFICATE_FILE_TYPE++;
    public static final int CRT = LAST_CERTIFICATE_FILE_TYPE++;
    public static final int DER = LAST_CERTIFICATE_FILE_TYPE++;
    public static final int PEM = LAST_CERTIFICATE_FILE_TYPE++;
    public static final int CER = LAST_CERTIFICATE_FILE_TYPE++;

    private static int ETC_FILE_INDEX = 500;

    /*EBOOK*/
    public static final int EPUB = ETC_FILE_INDEX++;
    public static final int ACSM = ETC_FILE_INDEX++;

    // Flash
    public static final int SWF = ETC_FILE_INDEX++;
    public static final int SVG = ETC_FILE_INDEX++;

    // Flash
    public static final int JAD = ETC_FILE_INDEX++;
    public static final int JAR = ETC_FILE_INDEX++;

    public static final int ICS = ETC_FILE_INDEX++;
    public static final int VCS = ETC_FILE_INDEX++;
    public static final int VCF = ETC_FILE_INDEX++;
    public static final int VNT = ETC_FILE_INDEX++;
    public static final int VTS = ETC_FILE_INDEX++;
    public static final int XHTML = ETC_FILE_INDEX++;
    public static final int EML = ETC_FILE_INDEX++;
    public static final int SASF = ETC_FILE_INDEX++;

    /**
     * Story album
     */
    public static final int SSF = ETC_FILE_INDEX++;
    public static final int SFF = ETC_FILE_INDEX++;
    public static final int SCC = ETC_FILE_INDEX++;
    public static final int SCC_SCRAP = ETC_FILE_INDEX++;
    public static final int SOL = ETC_FILE_INDEX++;

    public static final int FILE_3D_CAPTURE_TYPE = ETC_FILE_INDEX++;

    /*NAL Encryption File*/
    public static final int ENC = ETC_FILE_INDEX++;
    public static final int LOC = ETC_FILE_INDEX++;

    /* Add for soundcamp*/
    public static final int LA = ETC_FILE_INDEX++;

    /* Add for gpx file */
    public static final int GPX = ETC_FILE_INDEX++;

    /* Add for iWork */
    public static final int PAGES = ETC_FILE_INDEX++;
    public static final int KEY = ETC_FILE_INDEX++;
    public static final int NUMBERS = ETC_FILE_INDEX++;

    /* Add for iOS's PassBook file */
    public static final int PASSBOOK = ETC_FILE_INDEX++;

    /* Add for torrent file */
    public static final int TORRENT = ETC_FILE_INDEX++;

    /* Add for RAR file */
    public static final int RAR = ETC_FILE_INDEX++;

    // FOLDER should be smaller than File type
    public static final int FOLDER = MtpConstants.FORMAT_ASSOCIATION;

    public static boolean isAudioFileType(int fileType) {
        return ((fileType >= FIRST_AUDIO_FILE_TYPE && fileType <= LAST_AUDIO_FILE_TYPE) || (fileType >= FIRST_MIDI_FILE_TYPE && fileType <= LAST_MIDI_FILE_TYPE));
    }

    public static boolean isVideoFileType(int fileType) {
        return (fileType >= FIRST_VIDEO_FILE_TYPE && fileType <= LAST_VIDEO_FILE_TYPE);
    }

    public static boolean isImageFileType(int fileType) {
        return (fileType >= FIRST_IMAGE_FILE_TYPE && fileType <= LAST_IMAGE_FILE_TYPE);
    }

    public static boolean isPlayListFileType(int fileType) {
        return (fileType >= FIRST_PLAYLIST_FILE_TYPE && fileType <= LAST_PLAYLIST_FILE_TYPE);
    }

    public static boolean isDocumentFileType(int fileType) {
        return (fileType >= FIRST_DOCUMENT_FILE_TYPE && fileType <= LAST_DOCUMENT_FILE_TYPE);
    }

    public static boolean isUnusedFilesCategoryType(int fileType) {
        return (isAudioFileType(fileType) || isVideoFileType(fileType) || isImageFileType(fileType) || isDocumentFileType(fileType));
    }

    /*add for china feature:category Apk */
    public static boolean isApkFileType(int fileType) {
        return (fileType == APK);
    }

    public static boolean isInstallFileType(int fileType) {
        return (fileType >= FIRST_INSTALL_FILE_TYPE && fileType <= LAST_INSTALL_FILE_TYPE);
    }

    public static boolean isDrmFileType(int fileType) {
        return (fileType >= FIRST_DRM_FILE_TYPE && fileType <= LAST_DRM_FILE_TYPE);
    }

    public static boolean isEncryptionFileType(int fileType) {
        return (fileType == ENC || fileType == LOC);
    }

    public static boolean isMIDFileType(int fileType) {
        return (fileType >= FIRST_MIDI_FILE_TYPE && fileType <= LAST_MIDI_FILE_TYPE);
    }

    public static boolean isPlayReadyType(int fileType) {
        return (fileType == PYA || fileType == PYV || fileType == WMA || fileType == WMV);
    }

    public static boolean isArchiveFileType(int fileType) {
        return (fileType >= FIRST_ARCHIVE_FILE_TYPE && fileType <= LAST_ARCHIVE_FILE_TYPE);
    }

    public static boolean is3DCaptureFileType(int fileType) {
        return fileType == FILE_3D_CAPTURE_TYPE;
    }

    public static boolean isiWorksFileType(int fileType) {
        return (fileType == FileType.PAGES || fileType == FileType.KEY || fileType == FileType.NUMBERS);
    }

    public static boolean needFileUriForIntentStream(int fileType) {
        return (fileType == LA || fileType == DOCM || fileType == PPTM);
    }

    public static int[] getVideoFileTypeRange() {
        return new int[]{FIRST_VIDEO_FILE_TYPE, LAST_VIDEO_FILE_TYPE};
    }

    public static int[] getImageFileTypeRange() {
        return new int[]{FIRST_IMAGE_FILE_TYPE, LAST_IMAGE_FILE_TYPE};
    }

    public static int[] getAudioFileTypeRange() {
        return new int[]{FIRST_AUDIO_FILE_TYPE, LAST_AUDIO_FILE_TYPE};
    }

    public static int[] getDocumentFileTypeRange() {
        return new int[]{FIRST_DOCUMENT_FILE_TYPE, LAST_DOCUMENT_FILE_TYPE};
    }
}
